package cluster.clustersingleton

import akka.actor.{Actor, ActorSystem, PoisonPill, Props}
import akka.cluster.singleton.{ClusterSingletonManager, ClusterSingletonManagerSettings}
import akka.event.Logging
import akka.http.javadsl.server.Route
import akka.http.scaladsl.Http
import akka.stream.ActorMaterializer
import com.typesafe.config.ConfigFactory

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._

/**
  * Created by sjzx on 2016/5/19.
  */
class TickCounter extends Actor {
  case class Tick(n:Int)
  override def preStart = self ! Tick(0)

  def receive ={
    case Tick(n) =>
      println(s"${self.path} - Tick $n")
      context.system.scheduler.scheduleOnce(1 second,self, Tick(n + 1))
  }
}